<!-- HTML header for doxygen 1.8.14-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Unity ML-Agents Toolkit: StackingSensor Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygenbase.css" rel="stylesheet" type="text/css" />
<link href="unity.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Unity ML-Agents Toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">StackingSensor Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Sensor that wraps around another Sensor to provide temporal stacking.  
 <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#details">More...</a></p>

<p>Inherits <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html">ISensor</a>.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a6e3a9a0be1972ce2bd5fcc19715b0e6f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a6e3a9a0be1972ce2bd5fcc19715b0e6f">StackingSensor</a> (<a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html">ISensor</a> wrapped, int numStackedObservations)</td></tr>
<tr class="memdesc:a6e3a9a0be1972ce2bd5fcc19715b0e6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the sensor.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a6e3a9a0be1972ce2bd5fcc19715b0e6f">More...</a><br /></td></tr>
<tr class="separator:a6e3a9a0be1972ce2bd5fcc19715b0e6f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa2fd8d0109a94b4402481226fab67d38"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#aa2fd8d0109a94b4402481226fab67d38">Write</a> (<a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1ObservationWriter.html">ObservationWriter</a> writer)</td></tr>
<tr class="memdesc:aa2fd8d0109a94b4402481226fab67d38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write the observation data directly to the <a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1ObservationWriter.html" title="Allows sensors to write to both TensorProxy and float arrays/lists.">ObservationWriter</a>.Note that this (and <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#a35984ee934a00afeec0a23b3ac676d85" title="Return a compressed representation of the observation.">GetCompressedObservation</a>) may be called multiple times per agent step, so should not mutate any internal state.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#aa2fd8d0109a94b4402481226fab67d38">More...</a><br /></td></tr>
<tr class="separator:aa2fd8d0109a94b4402481226fab67d38"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aec0783b5a136e042adcc47bae4fe5291"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#aec0783b5a136e042adcc47bae4fe5291">Update</a> ()</td></tr>
<tr class="memdesc:aec0783b5a136e042adcc47bae4fe5291"><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates the index of the "current" buffer.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#aec0783b5a136e042adcc47bae4fe5291">More...</a><br /></td></tr>
<tr class="separator:aec0783b5a136e042adcc47bae4fe5291"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a372de693ad40b3f42839c8ec6ac845f4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a372de693ad40b3f42839c8ec6ac845f4">Reset</a> ()</td></tr>
<tr class="memdesc:a372de693ad40b3f42839c8ec6ac845f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resets the internal states of the sensor.This is called at the end of an <a class="el" href="classUnity_1_1MLAgents_1_1Agent.html" title="An agent is an actor that can observe its environment, decide on the best course of action using thos...">Agent</a>'s episode. Most implementations can leave this empty.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a372de693ad40b3f42839c8ec6ac845f4">More...</a><br /></td></tr>
<tr class="separator:a372de693ad40b3f42839c8ec6ac845f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aef68eb3f98b05b31a0bbee0ff016a012"><td class="memItemLeft" align="right" valign="top">int[]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#aef68eb3f98b05b31a0bbee0ff016a012">GetObservationShape</a> ()</td></tr>
<tr class="memdesc:aef68eb3f98b05b31a0bbee0ff016a012"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the size of the observations that will be generated.For example, a sensor that observes the velocity of a rigid body (in 3D) would return new {3}. A sensor that returns an RGB image would return new [] {Height, Width, 3}  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#aef68eb3f98b05b31a0bbee0ff016a012">More...</a><br /></td></tr>
<tr class="separator:aef68eb3f98b05b31a0bbee0ff016a012"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac97112280cc4435c8df3c88070c839b4"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#ac97112280cc4435c8df3c88070c839b4">GetName</a> ()</td></tr>
<tr class="memdesc:ac97112280cc4435c8df3c88070c839b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the name of the sensor.This is used to ensure deterministic sorting of the sensors on an <a class="el" href="classUnity_1_1MLAgents_1_1Agent.html" title="An agent is an actor that can observe its environment, decide on the best course of action using thos...">Agent</a>, so the naming must be consistent across all sensors and agents.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#ac97112280cc4435c8df3c88070c839b4">More...</a><br /></td></tr>
<tr class="separator:ac97112280cc4435c8df3c88070c839b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15f2369f7b537b7800511dbbb3a6e78f"><td class="memItemLeft" align="right" valign="top">virtual byte[]&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a15f2369f7b537b7800511dbbb3a6e78f">GetCompressedObservation</a> ()</td></tr>
<tr class="memdesc:a15f2369f7b537b7800511dbbb3a6e78f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a compressed representation of the observation.For small observations, this should generally not be implemented. However, compressing large observations (such as visual results) can significantly improve model training time.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a15f2369f7b537b7800511dbbb3a6e78f">More...</a><br /></td></tr>
<tr class="separator:a15f2369f7b537b7800511dbbb3a6e78f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1989f63693837ace8d493fa6acadffa6"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="namespaceUnity_1_1MLAgents_1_1Sensors.html#ad583e4111fa36e890e22d131c63f30f5">SensorCompressionType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a1989f63693837ace8d493fa6acadffa6">GetCompressionType</a> ()</td></tr>
<tr class="memdesc:a1989f63693837ace8d493fa6acadffa6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the compression type being used.If no compression is used, return <a class="el" href="namespaceUnity_1_1MLAgents_1_1Sensors.html#ad583e4111fa36e890e22d131c63f30f5a6adf97f83acf6453d4a6a4b1070f3754" title="No compression.">SensorCompressionType.None</a>.  <a href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html#a1989f63693837ace8d493fa6acadffa6">More...</a><br /></td></tr>
<tr class="separator:a1989f63693837ace8d493fa6acadffa6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Sensor that wraps around another Sensor to provide temporal stacking. </p>
<p>Conceptually, consecutive observations are stored left-to-right, which is how they're output For example, 4 stacked sets of observations would be output like | t = now - 3 | t = now -3 | t = now - 2 | t = now | Internally, a circular buffer of arrays is used. The m_CurrentIndex represents the most recent observation.</p>
<p>Currently, compressed and multidimensional observations are not supported.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a6e3a9a0be1972ce2bd5fcc19715b0e6f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6e3a9a0be1972ce2bd5fcc19715b0e6f">&#9670;&nbsp;</a></span>StackingSensor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html">StackingSensor</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html">ISensor</a>&#160;</td>
          <td class="paramname"><em>wrapped</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numStackedObservations</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initializes the sensor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">wrapped</td><td>The wrapped sensor.</td></tr>
    <tr><td class="paramname">numStackedObservations</td><td>Number of stacked observations to keep.</td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a15f2369f7b537b7800511dbbb3a6e78f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a15f2369f7b537b7800511dbbb3a6e78f">&#9670;&nbsp;</a></span>GetCompressedObservation()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual byte [] GetCompressedObservation </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return a compressed representation of the observation.For small observations, this should generally not be implemented. However, compressing large observations (such as visual results) can significantly improve model training time. </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#a35984ee934a00afeec0a23b3ac676d85">ISensor</a>.</p>

</div>
</div>
<a id="a1989f63693837ace8d493fa6acadffa6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1989f63693837ace8d493fa6acadffa6">&#9670;&nbsp;</a></span>GetCompressionType()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="namespaceUnity_1_1MLAgents_1_1Sensors.html#ad583e4111fa36e890e22d131c63f30f5">SensorCompressionType</a> GetCompressionType </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the compression type being used.If no compression is used, return <a class="el" href="namespaceUnity_1_1MLAgents_1_1Sensors.html#ad583e4111fa36e890e22d131c63f30f5a6adf97f83acf6453d4a6a4b1070f3754" title="No compression.">SensorCompressionType.None</a>. </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#ad5e3028f0557ae6baaa7637ee7363232">ISensor</a>.</p>

</div>
</div>
<a id="ac97112280cc4435c8df3c88070c839b4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac97112280cc4435c8df3c88070c839b4">&#9670;&nbsp;</a></span>GetName()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">string GetName </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the name of the sensor.This is used to ensure deterministic sorting of the sensors on an <a class="el" href="classUnity_1_1MLAgents_1_1Agent.html" title="An agent is an actor that can observe its environment, decide on the best course of action using thos...">Agent</a>, so the naming must be consistent across all sensors and agents. </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#ac97112280cc4435c8df3c88070c839b4">ISensor</a>.</p>

</div>
</div>
<a id="aef68eb3f98b05b31a0bbee0ff016a012"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef68eb3f98b05b31a0bbee0ff016a012">&#9670;&nbsp;</a></span>GetObservationShape()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int [] GetObservationShape </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the size of the observations that will be generated.For example, a sensor that observes the velocity of a rigid body (in 3D) would return new {3}. A sensor that returns an RGB image would return new [] {Height, Width, 3} </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#aef68eb3f98b05b31a0bbee0ff016a012">ISensor</a>.</p>

</div>
</div>
<a id="a372de693ad40b3f42839c8ec6ac845f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a372de693ad40b3f42839c8ec6ac845f4">&#9670;&nbsp;</a></span>Reset()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Reset </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Resets the internal states of the sensor.This is called at the end of an <a class="el" href="classUnity_1_1MLAgents_1_1Agent.html" title="An agent is an actor that can observe its environment, decide on the best course of action using thos...">Agent</a>'s episode. Most implementations can leave this empty. </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#a372de693ad40b3f42839c8ec6ac845f4">ISensor</a>.</p>

</div>
</div>
<a id="aec0783b5a136e042adcc47bae4fe5291"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aec0783b5a136e042adcc47bae4fe5291">&#9670;&nbsp;</a></span>Update()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Update </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Updates the index of the "current" buffer. </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#aec0783b5a136e042adcc47bae4fe5291">ISensor</a>.</p>

</div>
</div>
<a id="aa2fd8d0109a94b4402481226fab67d38"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa2fd8d0109a94b4402481226fab67d38">&#9670;&nbsp;</a></span>Write()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Write </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1ObservationWriter.html">ObservationWriter</a>&#160;</td>
          <td class="paramname"><em>writer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Write the observation data directly to the <a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1ObservationWriter.html" title="Allows sensors to write to both TensorProxy and float arrays/lists.">ObservationWriter</a>.Note that this (and <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#a35984ee934a00afeec0a23b3ac676d85" title="Return a compressed representation of the observation.">GetCompressedObservation</a>) may be called multiple times per agent step, so should not mutate any internal state. </p>

<p>Implements <a class="el" href="interfaceUnity_1_1MLAgents_1_1Sensors_1_1ISensor.html#aa2fd8d0109a94b4402481226fab67d38">ISensor</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="StackingSensor_8cs.html">StackingSensor.cs</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespaceUnity.html">Unity</a></li><li class="navelem"><a class="el" href="namespaceUnity_1_1MLAgents.html">MLAgents</a></li><li class="navelem"><a class="el" href="namespaceUnity_1_1MLAgents_1_1Sensors.html">Sensors</a></li><li class="navelem"><a class="el" href="classUnity_1_1MLAgents_1_1Sensors_1_1StackingSensor.html">StackingSensor</a></li>
  </ul>
</div>
</body>
</html>
